home *** CD-ROM | disk | FTP | other *** search
/ Plug-In Power Pack for Netscape Communicator / Plug-In Power Pack for Netscape Communicator.iso / plugins / dataviews / include / dvstd.h < prev    next >
C/C++ Source or Header  |  1997-05-08  |  28KB  |  752 lines

  1. /* @(#)dvstd.h    V2.94    6/14/95 */
  2.  
  3. /*
  4. |    file name -- dvstd.h
  5. |===================================================================
  6. |
  7. |                          copyright (c) 1987
  8. |                           V.I. Corporation
  9. |
  10. |    dvstd.h -- DataViews Public Types and some constant definitions
  11. |
  12. |    alan c morse      6 dec 82
  13. |
  14. |    alan c morse    31 Dec 83    Add DIV_BY_* macros
  15. |    alan c morse    13 April 84    Add DV_COORD typedef
  16. |    alan c morse    19 April 84    Add V_FV_MULT_RANGE and
  17. |                    shorten some names to
  18. |                    be unique in seven characters
  19. |    alan c morse    23 Dec 86    Add PV_PAIR
  20. |    russell turner    29 Dec 87    Add COLOR_TABLE typedef
  21. |    russell turner    26 Feb 88    Add VPdgaxlabel/vdsymbol flags
  22. |    john methot    19 dec 90    Add V_GLOBAL, V_LOCAL
  23. |       marianne smith  16 Jan 91       Added V_BF_LATEST_N, V_BF_DISP,
  24. |                                       V_BF_UNDISP, V_BF_OLD_TO_NEW, and
  25. |                                       V_BF_NEW_TO_OLD.
  26. |       marianne smith  22 Jan 91       Added display formatter status flags. 
  27. |       marianne smith  29 may 91       Added V_Q_DATA_SLOTSIZE query flag.
  28. |       lynn smith      12 Apr 94       Changed COORD, POINT, SUCCESS to DV_*
  29. |
  30. |===================================================================
  31. |
  32. |    include-file description/function:
  33. |    This contains the typedefs for DataViews Public Types.
  34. |    These are types which can be accessed directly by the dataviews
  35. |    application programmer.  This is in contrast to
  36. |    Dataviews Private Types, which can only be accessed
  37. |    through DV-Tools functions.
  38. |    Also, some constant definitions are contained.
  39. |
  40. |===================================================================
  41. */
  42.  
  43. #ifndef DVSTD_H
  44. #define DVSTD_H
  45.  
  46. #include "std.h"
  47. #include "dvmarker.h"
  48. #include "dvdatatypes.h"
  49. #include "dvfonts.h"
  50.  
  51. #define DV_SUCCESS YES
  52. #define DV_FAILURE NO
  53.  
  54. /*
  55.   COLOR_SPEC  and RGB_SPEC typedef.
  56.   Typedef for a structure that describes a color to be used
  57.   in DataViews.  It allows the representation of an index into
  58.   a device's color lookup table or an r,g,b color specification.
  59.   The representation comprises four bytes.  The first is a flag
  60.   that determines the type of representation.  If the first byte
  61.   is zero, then the four bytes are an index into a color lookup table.
  62.   If the first byte is -1, then the remaining three bytes correspond
  63.   to the rgb representation of a color.  (This is the RGB_SPEC
  64.   typedef.  Note that the -1 as the rgb_rep_flag is only necessary
  65.   when RGB_SPEC is included in a COLOR_SPEC typedef.  If the typedef
  66.   is used in a structure by itself--as when setting up the color
  67.   lookup table with GRs_color_table--then this flag is unnecessary.)
  68.   
  69.   NOTE that this representation is MACHINE DEPENDENT.
  70.   The structure should be declared so that the
  71.   rgb_rep_flag corresponds to the position of the high byte of a
  72.   long integer.
  73. */
  74.     typedef struct _RGB_SPEC
  75.       {
  76. #ifdef BYTE_ORDER_1234
  77.       char rgb_rep_flag; /* Should be -1 when used in COLOR_SPEC */
  78.       UBYTE red, green, blue;
  79. #endif
  80. #ifdef BYTE_ORDER_4321
  81.       UBYTE blue, green, red;
  82.       char rgb_rep_flag; /* Should be -1 when used in COLOR_SPEC */
  83. #endif
  84.       } RGB_SPEC;
  85.  
  86.     typedef union COLOR_SPEC
  87.       {
  88.       LONG color_index; /* Should always be >= 0 */
  89.       RGB_SPEC rgb_rep;
  90.       } COLOR_SPEC;
  91.  
  92. /* Color index to indicate that a color field is not yet defined */
  93. #define UNDEFINED_COLOR_INDEX 0x7fffffff
  94.  
  95. /*
  96.   COLOR_TABLE typedef
  97.   Data structure used for storing the color look-up table.
  98. */
  99.     typedef struct
  100.       {
  101.       int ctsize;
  102.       RGB_SPEC ct[256];
  103.       } COLOR_TABLE;
  104.  
  105. /* COLOR_XFORM typedef
  106.    Data structure for defining a transformation from one color table's
  107.    indices to another's.
  108. */
  109.     typedef struct
  110.       {
  111.       int size;
  112.       int new_index[256];
  113.       } COLOR_XFORM;
  114.  
  115. /*
  116.   COLOR_THRESHOLD typedef.
  117.   Entry in a thresholding table that gives the color associated with a
  118.   variable as a function of the variable's value, where the color
  119.   of the display of the variable depends on the normalized
  120.   (in range [0,32767] ) variable value as follows:
  121.   use threshcolor i ( 1<=i<=colcount ) such that
  122.   upperlimit( i-1 ) < value <= upperlimit(i).
  123.   NOTE upperlimit(0) = 0 by definition.
  124. */
  125.     typedef struct COLOR_THRESHOLD
  126.       {
  127.       short upperlimit;
  128.       COLOR_SPEC threshcolor;
  129.       } COLOR_THRESHOLD;
  130.  
  131. /*
  132.   PLR_POINT typedef.
  133.   This is the structure for polar coordinates of a point.
  134. */
  135. typedef struct PLR_POINT
  136.     {
  137.     short radius;
  138.     short angle;
  139.     } PLR_POINT;
  140.  
  141. /*
  142.   DV_COORD, DV_POINT typedefs.
  143.   This is the structure for the coordinates of a point.
  144. */
  145. typedef LONG DV_COORD;
  146. typedef struct DV_POINT
  147.     {
  148.     DV_COORD x;
  149.     DV_COORD y;
  150.     } DV_POINT;
  151.  
  152. /* FLOAT_POINT, where the coordinates are stored as floats. */
  153. /* This is useful for greater precision than POINTs */
  154. /* or for storing points that are in normalized device coords. */
  155. /* In the latter case, the lower left corner would be (0.0, 0.0) */
  156. /* and the upper right would be (1.0, 1.0) */
  157.  
  158. typedef struct FLOAT_POINT
  159.   {
  160.   float x,y;
  161.   } FLOAT_POINT;
  162.  
  163. /*
  164.   ANYTYPE typedef.
  165.   Typdef for use when a variable can be one of several scalar types.
  166. */
  167. typedef union ANYTYPE
  168.       {
  169.       char c;
  170.       UBYTE uc;
  171.       short s;
  172.       unsigned short us;
  173.       LONG l;
  174.       ULONG ul;
  175.       float f;
  176.       double d;
  177.       ADDRESS ptr;
  178.       union ANYTYPE *ap;
  179.       } ANYTYPE;
  180.  
  181. /*
  182. |  DV_STRUCT_MEMBER typedef.
  183. |  Describes the elements of a structure.
  184. */
  185.  
  186. typedef struct DV_STRUCT_MEMBER
  187. {
  188.   char *name;                   /* name of field */
  189.   char *type;                   /* name of field's type */
  190.   short offset;                 /* offset of field in structure */
  191. } DV_STRUCT_MEMBER;
  192.  
  193. /*
  194.   NAME_VALUE_PAIR typedef.
  195.   Name-value pair for passing arguments to display formatters.
  196. */
  197.   typedef struct
  198.     {
  199.     char *name;
  200.     char *value;
  201.     } NAME_VALUE_PAIR;
  202.  
  203. /*
  204.   LABEL_SIZE typedef.
  205.   Describes the size attributes of a string.  This is used by
  206.   axis labelling routines to return the attributes of an axis
  207.   tick label, which may be multiline strings.
  208. */
  209.   typedef struct
  210.     {
  211.     int StringLength; /* Number of characters in the string */
  212.     short NumLines; /* Number of lines in the string;
  213.       | 0 or 1 means that it is a single line string.
  214.       | More than 1 means that there are imbedded carriage
  215.       | returns. */
  216.     short LongestLine; /* Number of characters in
  217.       | the longest line of the multi-line string.  If there
  218.       | is only one line this value is the same as the
  219.       | StringLength.  In the case where NumLines is zero,
  220.       |    and LongestLine is zero, the value for LongestLine
  221.       |    is taken to be equal to StringLength */
  222.     } LABEL_SIZE;
  223.  
  224. /*
  225.   ENTRY_PT typedefs.
  226.   This is an entry point for a function that returns a int
  227. */
  228.   typedef int (*ENTRY_PT)();
  229.  
  230. /*
  231.   RECTANGLE typedef.
  232.   This structure contains the corner points that define a rectangle
  233.   that is oriented orthogonally with respect to the coordinate system.
  234.   Thus RECTANGLE can be used to define a viewport.  The two points
  235.   are the lower left and the upper right corners of the rectangle.
  236. */
  237.   typedef struct RECTANGLE
  238.     {
  239.     DV_POINT ll; /* Lower left corner of the rectangle. */
  240.     DV_POINT ur; /* Upper right corner of the rectangle. */
  241.     } RECTANGLE;
  242.  
  243. /*
  244.   RECTANGLE_PRE_9_1 typedef
  245.   This is the type of rectangle that is compatible
  246.   with the RECTANGLE structure for releases of DataViews prior to 9.1.
  247. */
  248. typedef struct RECTANGLE_PRE_9_1
  249.     {
  250.     struct { short x,y; } ll; /* Lower left corner of the rectangle. */
  251.     struct { short x,y; } ur; /* Upper right corner of the rectangle. */
  252.     } RECTANGLE_PRE_9_1;
  253.  
  254. /*
  255.   PIXREP typedef.
  256.   This structure provides a way to describe arbitrary pixel-based
  257.   graphics data. See the file VUpixrep.h for more information.
  258. */
  259. typedef struct
  260.   {
  261.   int width, height;        /* width and height in pixels */
  262.   UBYTE depth;            /* number of bits of color information */
  263.   UBYTE bits_per_pixel;        /* 1,2,4,8,16,32 bits */
  264.   UBYTE row_alignment;        /* 8,16,32==Rows aligned on char,short,LONG */
  265.   DV_BOOL  origin_at_ll;        /* is origin in lower-left? */
  266.   UBYTE pack_unit;        /* if bits/pixel < 8, packing unit */
  267.   DV_BOOL  pack_msf_in_byte;    /* if bits/pixel < 8, order of pixels in byte */
  268.   DV_BOOL  pack_msf_in_unit;    /* if bits/pixel < 8, order of bytes in unit */
  269.   LONG   pixels_length;        /* length of pixel array */
  270.   UBYTE *pixels;        /* actual pixels */
  271.   /* if (pclut != NULL), pixels are index into color table (*pclut) */
  272.   COLOR_TABLE *pclut;
  273.   DV_BOOL *color_used;        /* which colors actually used (if known) */
  274.   /* if (pclut == NULL), pixels are direct color: */
  275.   ULONG red_mask;        
  276.   int   red_shift;        
  277.   ULONG grn_mask;        /* For green component of pixel, calculate */
  278.   int   grn_shift;        /* ((pixel & grn_mask) >> grn_shift)       */
  279.   ULONG blu_mask;        
  280.   int   blu_shift;        /* & similarly for red and blue components */
  281.   } PIXREP;
  282. /*-------------------------------------------------------------
  283. |
  284. |    Private types used by the VP/VG/VU/VT
  285. */
  286. /* Define data group pointers and variable descriptor pointers */
  287. /* for end applications programmers */
  288. #ifndef DATAGROUP
  289. #define DATAGROUP      ADDRESS        /* dgp -- data group */
  290. #endif
  291. #define VARDESC           ADDRESS        /* vdp -- variable descriptor */
  292. #define DISPFORM        ADDRESS         /* df   display formatter */
  293. #define SYMTABLE        ADDRESS         /* st   symbol table */
  294. #define SYMNODE         ADDRESS         /* sn   symbol table node */
  295.  
  296. /* Obsolete synonyms */
  297. #define DG_PTR     ADDRESS
  298. #define VD_PTR     ADDRESS
  299. #define VAR_DESC   ADDRESS
  300.  
  301.  
  302. /*===================================================================
  303. |    Constants used by TdsvGet/SetGlobalFlag
  304. | -----------------------------------------------------------------
  305. */
  306. #define V_LOCAL        1
  307. #define V_GLOBAL    2
  308.  
  309. /*===================================================================
  310. |    Constants used by TdsvEdit/GetAttributes
  311. | -----------------------------------------------------------------
  312. */
  313. #define V_SINGLE_QUOTED  '\001'
  314. #define V_DOUBLE_QUOTED  '\002'
  315.  
  316. /*-------------------------------------------------------------------
  317. |    Flags used by VP/VGinfo()
  318. */
  319. typedef enum
  320. {
  321.   DV_DG_ATTR_ARGEND,
  322.   DV_DG_AXIS_LABEL,        /* Axis label */
  323.   DV_DG_CONTEXT,        /* Context flags */
  324.   DV_DG_DF,            /* Display formatter */
  325.   DV_DG_DF_ADD_ARG,        /* Add/get a single arg/value pair */
  326.   DV_DG_DF_ARG_VALUE,        /* Get value for a single arg */
  327.   DV_DG_DF_ARGS,        /* Get/set an array of arg/values */
  328.   DV_DG_DF_CONTEXT_ONLY,    /* Context only flag */
  329.   DV_DG_DF_DEL_ARG,        /* Delete arg/value pair */
  330.   DV_DG_GRID_ATTR,        /* Grid attributes */
  331.   DV_DG_SCROLL_AMOUNT,        /* Scroll amount */
  332.   DV_DG_SLOTS,            /* Slots for time series */
  333.   DV_DG_TIC_LAB_FCN,        /* Tic labelling function */
  334.   DV_DG_TIME_START_INCR,    /* Start time and increment */
  335.   DV_DG_TITLE            /* Title for graph */
  336. } DV_DG_ATTR_ENUM;
  337.  
  338. typedef enum
  339. {
  340.   DV_VD_ATTR_ARGEND,
  341.   DV_VD_ACC_MODE,        /* Access mode */
  342.   DV_VD_DRANGE,            /* Range as doubles */
  343.   DV_VD_IRANGE,            /* Range as ints */
  344.   DV_VD_ACCESS,            /* Access function */
  345.   DV_VD_BASE,            /* Base addres */
  346.   DV_VD_CLR_INDX,        /* Color index */
  347.   DV_VD_CTT,            /* Color threshold table */
  348.   DV_VD_DIM,            /* Dimension */
  349.   DV_VD_DIRECT_ACCESS,        /* Is variable accessed directly? */
  350.   DV_VD_LOG,            /* Log/linear flag */
  351.   DV_VD_LTYPE,            /* Line type */
  352.   DV_VD_LWIDTH,            /* Line width */
  353.   DV_VD_RGB,            /* Color as rgb triple */
  354.   DV_VD_SYMBOL,            /* Symbol */
  355.   DV_VD_TIC_LAB_FCN,        /* Tic labelling function */
  356.   DV_VD_TYPE,            /* Type of variable */
  357.   DV_VD_VAL_LABEL,        /* Value label of variable */
  358.   DV_VD_VAR_NAME        /* Name of variable */
  359. } DV_VD_ATTR_ENUM;
  360.  
  361. /*===================================================================
  362. |   Context CONTROL FLAGS
  363. |    Constants which have bit patterns that correspond to the bit
  364. |    fields in the DATAGROUP structure for the context control flags.
  365. | -----------------------------------------------------------------
  366. */
  367. #define V_FPRE_ERASE        0x1            /* Erase before drawing? */
  368. #define V_FCONTEXT        0x2            /* Draw context? */
  369. #define V_FLEGEND        0x4            /* Draw legend? */
  370. #define V_FVPBOX        0x8            /* Draw box around graph? */
  371.  
  372. #define V_FT_TICS        0x10    /* Draw time axis ticks? */
  373. #define V_FT_MINTICS        0x20    /* Minimum time ticks ? */
  374. #define V_FT_LABEL_TICS     0x40    /* Label time axis ticks? */
  375.  
  376. #define V_FD1_TICS        0x80    /* Draw d1 axis ticks? */
  377. #define V_FD1_MINTICS        0x100    /* Minimum d1 ticks ? */
  378. #define V_FD1_LABEL_TICS    0x200    /* Label d1 axis ticks? */
  379.  
  380. #define V_FD2_TICS        0x400    /* Draw d2 axis ticks? */
  381. #define V_FD2_MINTICS        0x800    /* Minimum d2 ticks ? */
  382. #define V_FD2_LABEL_TICS    0x1000    /* Label d2 axis ticks? */
  383.  
  384. #define V_FV_TICS        0x2000    /* Draw value axis ticks? */
  385. #define V_FV_MINTICS        0x4000    /* Minimum value ticks ? */
  386. #define V_FV_LABEL_TICS        0x8000    /* Label value axis ticks? */
  387. #define V_FV_MULT_RANGE        0x10000    /* Multiple value ranges? */
  388.  
  389. #define V_FV_GRID        0x20000    /* Draw value axis grid? */
  390. #define V_FT_GRID        0x40000    /* Draw time axis grid? */
  391.  
  392. #define V_FPITCH_TICS       0x80000     /* Draw pitch tick marks. */
  393. #define V_FPITCH_LABEL_TICS 0x100000    /* Label pitch tick marks. */
  394.  
  395. #define V_FROLL_TICS        0x200000    /* Draw roll tick marks */
  396. #define V_FROLL_LABEL_TICS  0x400000    /* Label roll tick marks. */
  397.  
  398. #define V_F_ALL            0x7fffff    /* All the flags */
  399.  
  400. /*-------------------------------------------------------------------
  401. |
  402. |     ARGUMENT CONSTANTS --
  403. |       Definitions of constants for type flags to be sent to various
  404. |       DataViews routines.
  405. |
  406. |   Flags for VPdgcreate indicating the type of data group to be created
  407. */
  408. # define V_DGNORMAL     1
  409. # define V_DGPROTOTYPE  2
  410. # define V_DGTEMPORARY  3
  411.  
  412. /*
  413. |   Flags for VPdgaxlabel and VGdgaxlabel
  414. */
  415. # define V_FIRST_AXIS    '1'
  416. # define V_SECOND_AXIS    '2'
  417. # define V_TIME_AXIS    't'
  418.  
  419.  
  420. /* Flags for VPvdaccmode indicating the access mode of the variable */
  421. /* V_DS_BOUND means that the variable is indirect access through a */
  422. /* a DataViews data source */
  423. # define V_DIR_ACCESS    0
  424. # define V_INDIR_ACCESS  1
  425. # define V_DS_BOUND      3
  426.  
  427. typedef LONG (*VGLONGACCESSFUNPTR) V_P_((ADDRESS args,
  428.                      int i, int j, int k));
  429. typedef double *(*VGDOUBLEACCESSFUNPTR) V_P_((ADDRESS args,
  430.                           int i, int j, int k));
  431. typedef ADDRESS (*VGADDRACCESSFUNPTR)V_P_((ADDRESS argp,
  432.                        int i3, int i2, int i1));
  433.  
  434. typedef VGLONGACCESSFUNPTR VPLONGACCESSFUNPTR;
  435. typedef VGDOUBLEACCESSFUNPTR VPDOUBLEACCESSFUNPTR;
  436. typedef VGADDRACCESSFUNPTR VPADDRACCESSFUNPTR;
  437.  
  438. /*     VPdgdfentry() takes a variety of different function pointers   */
  439. typedef int (*VPDGDFENTRYFUNPTR) V_P_(());
  440.      
  441. /*----------------------------------------------------------------------
  442. |
  443. |     DISPLAY FORMATTER JUMP TABLE INDICES --
  444. |    Definitions of indices for the various entry points into a
  445. |    display formatter jump table.  The jump table has a fixed size,
  446. |    and each position in the display jump table corresponds to
  447. |    a specific display formatter function according to the
  448. |    definitions below.  Currently, these definitions
  449. |    CANNOT BE CHANGED without changing without recoding the
  450. |    table initializations for each display formatter.
  451. |    You can add to these definitions without affecting existing dfs.
  452. |    If the df doesn't have the appropriate function,
  453. |    the pointer is NULL.
  454. |
  455. |   Number of pointers in jump table.
  456. */
  457. # define V_DFTABLE_SIZE 11
  458.  
  459. /*
  460. |   Index of pointer to routine to call when this is the first time
  461. |   that this display formatter has been called for the data group.
  462. */
  463. # define V_INITIAL_DISPLAY 0
  464.  
  465. /*
  466. |   Index of pointer to routine that cleans up the heap storage that
  467. |   the display formatter has allocated.  This is called whenever
  468. |   the display formatter is disconnected from the data group.
  469. |   Also used as part of the new display formatter structure.
  470. */
  471. # define V_CLEANUP_ALLOCS 1
  472.  
  473. /*
  474. |   Index of pointer to routine to call when the display context has
  475. |   already been created, and the display is to be updated to include
  476. |   the encoding of the latest data.
  477. */
  478. # define V_UPDATE_DISPLAY 2
  479.  
  480. /*
  481. |   Index of pointer to routine to call when the display formatter is
  482. |   incapable of displaying the data in the data group.
  483. |   Whether this routine is to be called is determined by a call
  484. |   to the initial display formatter routine.
  485. */
  486. # define V_CANT_DISPLAY 3
  487.  
  488. /*
  489. |   Index of pointer to routine to call when the user wants information
  490. |   from the display formatter.  This routine expects two arguments.
  491. |   The first is a flag indicating the type of information required,
  492. |   the second is a pointer to a structure into which the routine is
  493. |   to put the answer.  The routine returns a flag indicating whether
  494. |   it failed in answering the question.  Success causes it to return
  495. |   DV_SUCCESS.  If an error occurred it returns DV_FAILURE.  The definitions
  496. |   of the possible flag values follow the list of pointer indices.
  497. |   Also used as part of the new display formatter structure.
  498. */
  499. # define V_QUERY_DISPLAY 4
  500.  
  501.  
  502. /***Entry points for the new display formatter structure***/
  503.  
  504. /*
  505. |   Index of pointer to routine to call before the first draw.
  506. |   Checks the data group (graph) against guard parameters which
  507. |   determine which data groups may be displayed.
  508. |   Allocates SAVED_DATA area if it doesn't exist yet.  This may
  509. |   involve reallocating subparts of SAVED_DATA that have changed size.
  510. |   Lays out the graph area.  Fills in information in SAVED_DATA area,
  511. |   which describes the graph layout and its behaviour.
  512. |   If can't draw with the current parameters, sets a flag in the
  513. |   SAVED_DATA area to that effect and installs a dummy displyay
  514. |   routine.
  515. |   Returns a flag indicating whether the context could be successfully
  516. |   set up.
  517. */
  518. # define V_SETUP_DISPLAY 5
  519.  
  520. /*
  521. |   Index of pointer to routine to call to draw the static portion
  522. |   of the graph.
  523. */
  524. # define V_DRAW_CONTEXT 6
  525.  
  526. /*
  527. |   Index of pointer to routine to call to draw the dynamic portion
  528. |   of the graph, displaying that portion of the data specified by
  529. |   the flag passed in as a parameter.
  530. */
  531. # define V_DRAW_DATA 7
  532.  
  533. /*
  534. |   Index of pointer to routine to call to get the next iterations
  535. |   worth of data into the graphs data buffers, using the variable
  536. |   descriptors.
  537. */
  538. # define V_TAKE_DATA 8
  539.  
  540. /*
  541. |   Index of pointer to routine to send flag and data value to
  542. |   to modify the runtime behaviour of the graph.  For example,
  543. |   set up a new color threshold table.
  544. */
  545. # define V_RECV_MESSAGE 9
  546.  
  547.  
  548. /*
  549. |    Display formatter Status Flags.
  550. |    Constants which have bit patterns that correspond to the bit
  551. |    fields in the DATAGROUP structure for the display formatter status flags.
  552. | -----------------------------------------------------------------
  553. */
  554. #define V_DGDF_CANT_DRAW     0x1 /* Display formatter can't be drawn? */
  555. #define V_DGDF_SETUP_DONE    0x2 /* Is setup of display formatter done? */
  556. #define V_DGDF_CONTEXT_DRAWN 0x4 /* Is the context drawn? */
  557. #define V_DGDF_ALL           0x7 /* All flags */
  558.  
  559.  
  560. /*
  561. |   Definitions of possible flag values for V_DRAW_DATA and
  562. |   V_DRAW_CONTEXT. Release 8.0
  563. */
  564. # define DV_NONE      -1 /* Do not draw anything, for the internal use only */
  565. # define V_LATEST_N   0  /* Draw n most recent pieces of data,
  566.                            |  where n is the number of history
  567.                 |  slots.  */
  568. # define V_ALL_NEW    1    /* Draw all undisplayed data */
  569. # define V_OLD          2    /* Re-draw the last displayed data */
  570.  
  571.  
  572. /*
  573. |   Definitions of possible draw_flag values for V_DRAW_DATA,
  574. |   V_DRAW_CONTEXT, and the VUbf functions. Release 9.0
  575. */
  576. # define V_BF_LATEST_N   V_LATEST_N  /* Draw n most recent pieces of data,
  577.                                 |  where n is the number of history
  578.                      |  slots.  */
  579. # define V_BF_UNDISP    V_ALL_NEW   /* Draw all undisplayed data */
  580. # define V_BF_DISP      V_OLD       /* Re-draw the last displayed data */
  581.  
  582. /*
  583. |  Definitions of possible flag values for VUbfShift().
  584. */
  585. #define V_BF_NEW_TO_OLD   1   /* Shift undisplayed data to the 
  586.                                       |  displayed data list. */
  587. #define V_BF_OLD_TO_NEW   2   /* Shift the displayed data to the
  588.                                       |  undisplayed data list.
  589.                                       |  NOTE: Not yet implemented. */ 
  590.  
  591. /*
  592. |   Structure definitions for display formatter queries.
  593. */
  594. #define V_Q_PICKED_VDP_MAX 64  /* Data Views will stop looking for
  595.                        | vdps at a pick location when this
  596.                        | many have been identified. */
  597. typedef struct V_Q_VDP          /*  A vdp with its dgp index. Used in
  598.                        |  V_Q_VDP_LIST and V_Q_PICK_VDP structs. */
  599.   {
  600.     VARDESC vdp;
  601.     int index;
  602.   } V_Q_VDP;
  603.  
  604. typedef struct V_Q_VDP_LIST     /*  A list of V_Q_VDPs, plus a count. Used to
  605.                            |  provide output for V_Q_VDPS_AT_LOCATION
  606.                  |  query. */
  607.   {
  608.     int count;
  609.     V_Q_VDP vdps[V_Q_PICKED_VDP_MAX];
  610.   } V_Q_VDP_LIST;
  611.  
  612. typedef struct V_Q_PICK_VDP    /*  Pick location and a V_Q_VDP struct. Used
  613.                                 |  as indata for V_Q_VALUE_AT_LOCATION,
  614.                 |  V_Q_DATA_VALUE and V_Q_FLOOR_VALUE
  615.                 |  queries. */
  616.   {
  617.     DV_POINT location;
  618.     V_Q_VDP *vdp;
  619.   } V_Q_PICK_VDP;  
  620.  
  621. /*
  622. |   Definitions of possible flag values for V_QUERY_DISPLAY.
  623. */
  624. # define V_Q_DATAVP   0  /* What is the rectangle that contains
  625.     | the data encoding area. The structure to receive the data is of
  626.     | type RECTANGLE. */
  627. # define V_Q_SLOTSIZE 1   /* What is the area devoted to
  628.     | encoding each datum.  The structure to receive the data is of
  629.     | type RECTANGLE. */
  630. # define V_Q_VAL_AT_CURSOR 2 /* The display formatter should
  631.     | read the current cursor position.  If it falls in a data slot,
  632.     | the routine returns the value of the data encoded in that slot.
  633.     | The structure that is to receive the data should be large enough
  634.     | to hold one data item from each variable. */
  635.  
  636. /* Display formatter-specific query flags */
  637. # define V_Q_VDTITLE_TEXTVP 3 /* Get from the VDtitle display
  638.     | formatter the viewport rectangle that is used in displaying
  639.     | the text variables. */
  640. # define V_Q_VDTITLE_CHARSIZE 4 /* Get from the VDtitle display
  641.     | formatter the character size used to display the text
  642.     | variables. */
  643. # define V_Q_DOES_CLIPPING 5 /* Return DV_SUCCESS if formatter
  644.     | handles clipping (new display formatter structure), otherwise
  645.     | return DV_FAILURE.  */
  646. # define V_Q_LEGSIZE  6     /* Get the size of the legend
  647.     | from VDlegend.  */
  648. # define V_Q_DATA_SLOTSIZE 7 /* Get the size of one data element for
  649.     | VDspectro, VDspectroinp, VDspectrostacked and VDspectrointpstkd. */
  650. # define V_Q_SLOT_AT_LOCATION 8  /* Get the slot index at the pick 
  651.     | location. Data input is the pick location. Data output holds an int. */
  652. # define V_Q_VDPS_AT_LOCATION 9 /* Get the indices of any vdps in the 
  653.     | dgp at the pick location. Data input is the pick location.  Data out 
  654.     | is a struct containing list of (int) indices and an (int) count field.*/ 
  655. # define V_Q_VALUE_AT_LOCATION  10  /* Get the value at the pick 
  656.     | location. Data input holds the pick location. Data out holds a double, 
  657.     | the value. */
  658. # define V_Q_SAMPLE_AT_LOCATION  11  /* Get the interpolated sample 
  659.     | number. Data input holds the pick location. Data out holds a double, 
  660.     | the sample. */ 
  661. # define V_Q_DATA_SAMPLE  12  /* Get the sample at the picked slot. 
  662.     | Data input holds the pick location, data out holds the sample as
  663.     | a double. */
  664. # define V_Q_DATA_VALUE  13  /* Get the value of the variable datum 
  665.     | that contains the pick location. Data input holds a V_Q_PICK_VDP sruct.
  666.     | Data output holds the raw or normalized value as a double. */
  667. # define V_Q_FLOOR_VALUE  14  /* Independent axis mapped value 
  668.     | corresponding to bottom of picked datum (useful for Area and Pigback 
  669.     | graphs). Data input holds a V_Q_PICK_VDP sruct, data output holds 
  670.     | the floor value as a double. */
  671. # define V_Q_SECTOR_AT_LOCATION 15  /* Get the sector index at the pick 
  672.     | location in a Radial graph. Data input is the pick location. Data output
  673.     | holds an int. */
  674.  
  675. /* ---- QUERY FLAGS -- RESERVED FOR CUSTOMER USE ------------------ 
  676. If you are a DataViews customer writing display formatters, for
  677. which you need special QUERY flags, use flag values in the range [100-199].
  678. You may then include the flags here.
  679. */
  680.  
  681. /*-------------------------------------------------------------------
  682. | MACROS to optimize multiplication and division by some powers of two.
  683. | These are accomplished by appropriate shifts on machines for which
  684. | shifting does the right thing.  (For instance, shifting will to the
  685. | right thing on MC68000 and VAX computers).  On no machine will these
  686. | macros do the right thing for dividing negative numbers.
  687. | This is because the numbers will be truncated away from zero rather
  688. | than towards zero.  This may not be disasterous, however.
  689. | The MULTiplication macros will work equally for positive and
  690. | negative numbers.
  691. */
  692. # define DIV_2(a) ((a)>>1)
  693. # define DIV_4(a) ((a)>>2)
  694. # define DIV_8(a) ((a)>>3)
  695. # define DIV_16(a) ((a)>>4)
  696. # define MUL_2(a) ((a)<<1)
  697. # define MUL_4(a) ((a)<<2)
  698. # define MUL_8(a) ((a)<<3)
  699. # define MUL_16(a) ((a)<<4)
  700.  
  701. /*-------------------------------------------------------------------
  702. | Typedefs for hash tables.
  703. */
  704. typedef ULONG (*VTHTCONVERTFUNPTR)V_P_((ADDRESS newkey));
  705. typedef int (*VTHTCOMPAREFUNPTR)V_P_((ADDRESS key1, ADDRESS key2));
  706. typedef void (*VTHTFREEKEYFUNPTR)V_P_((ADDRESS key));
  707. typedef void (*VTHTFREEVALFUNPTR)V_P_((ADDRESS value));
  708. typedef void (*VTHTTRAVERSEFUNPTR)V_P_((ADDRESS key, ADDRESS value, ADDRESS args));
  709. typedef int (*VTSTCOMPAREFUNPTR)V_P_((ADDRESS searchkey, ADDRESS key));
  710. typedef void (*VTSTTRAVERSEFUNPTR)V_P_((ADDRESS key, ADDRESS value, ADDRESS args));
  711.  
  712. /*-------------------------------------------------------------------
  713. | Miscellaneous function pointers.
  714. */
  715. typedef int (*VUSLTRVRSFUNPTR) V_P_((char *string,
  716.                      int index,
  717.                      ADDRESS argblock));
  718.  
  719. typedef int (*GRPALPICKFUNPTR) V_P_((LONG fbcolor, RECTANGLE *echovp));
  720.  
  721. /*-------------------------------------------------------------------
  722. | values to control data structure traversals
  723. | NOTE that these values should NOT be changed, because a lot of
  724. | code assumes that CONTINUE is null.
  725. */
  726. # define V_CONTINUE_TRAVERSAL    0
  727. # define V_HALT_TRAVERSAL    1
  728.  
  729. /* Backward compatibility of upgraded typedefs and defines */
  730.  
  731.  
  732. #ifdef DV_OLD_NAMES
  733. #ifdef NOT_WINNT
  734. #define POINT DV_POINT
  735. #define COORD DV_COORD
  736. #define SUCCESS DV_SUCCESS
  737. #define FAILURE DV_FAILURE
  738. #define V_NONE DV_NONE
  739. #endif /* NOT_WINNT */
  740. #endif /* DV_OLD_NAMES */
  741.  
  742. #ifdef WINNT
  743. #define DV_PORTRAIT 1
  744. #define DV_LANDSCAPE 2
  745. #define DV_DRAFT -1
  746. #define DV_LOW -2
  747. #define DV_MEDIUM -3
  748. #define DV_HIGH -4
  749. #endif
  750.  
  751. #endif /* DVSTD_H */
  752.